home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Fatted Calf
/
The Fatted Calf.iso
/
Applications
/
Games
/
NeXTmille
/
Source
/
cheap_strings.psw
< prev
next >
Wrap
Text File
|
1990-10-26
|
1KB
|
55 lines
/* These routines draw strings into boxed areas.
** The strings are drawn as such that they are displayed centered justified within
** the box.
**
*/
defineps draw_string( float box[4], font_color, point_size; char *theString )
/Times-Roman findfont point_size scalefont setfont
(theString) stringwidth % Calculate the width and height of the string
/ywidth exch def % and save.
/xwidth exch def
\box[2] xwidth sub 2 div \box[0] add % Calculate the X position to display the
% string.
\box[3] ywidth sub 2 div \box[1] add % Calculate the Y position to display the
% string
moveto % Position the string
font_color setgray % Display the string
(theString) show
endps
defineps draw_int( float box[4], font_color, point_size; int theInt )
/Times-Roman findfont point_size scalefont setfont
/theString 20 string def % Convert the int to a string for later display
/theString theInt theString cvs def
theString stringwidth % Calculate the width and height of the string
/ywidth exch def % and save.
/xwidth exch def
\box[2] xwidth sub 2 div \box[0] add % Calculate the X position to display the
% string.
\box[3] ywidth sub 2 div \box[1] add % Calculate the Y position to display the
% string
moveto % Position the string
font_color setgray % Display the string
theString show
endps